<template>
  <page>
    <template v-slot:header>
      <h2>
        <i class="icon iconfont">&#xe611;</i>
        <span>{{ $t("configure.suse_migrate_tool") }}</span>
      </h2>
    </template>
    <template v-slot:content>
      <ky-table :getData="getAgentList" ref="table" :search_data="search_data">
        <template v-slot:table-action>
          <a
            class="
              el-button
              kylin-item-button
              el-button--default el-button--small
            "
          >
            {{ $t("configure.export_unregister_host") }}
          </a>
          <el-button class="kylin-item-button">
            {{ $t("configure.unlock") }}
          </el-button>
          <el-button class="kylin-item-button">
            {{ $t("configure.migrate") }}
          </el-button>
        </template>
        <template v-slot:table>
          <el-table-column type="expand">
            <template slot-scope="scope">
              <expand-table :data="scope.row.data || []"></expand-table>
            </template>
          </el-table-column>
          <el-table-column :label="$t('configure.suse_ip')" prop="ip">
          </el-table-column>
          <el-table-column
            prop="normal_library_name"
            :label="$t('configure.normal_library_name')"
          >
          </el-table-column>
          <el-table-column
            prop="architecture"
            :label="$t('system.architecture')"
          >
          </el-table-column>
          <el-table-column prop="version" :label="$t('system.version')">
          </el-table-column>
          <el-table-column prop="status" :label="$t('system.status')">
          </el-table-column>
          <el-table-column :label="$t('action')">
            <template slot-scope="scope">
              <el-button
                @click.native.prevent="handleComfirm(scope.row)"
                type="text"
                size="medium"
              >
                {{ $t("configure.confirm_configure_item") }}
              </el-button>
            </template>
          </el-table-column>
        </template>
      </ky-table>
    </template>
  </page>
</template>

<script>
import Page from "@/components/Page";
import kyTable from "@/components/KyTable";
import ExpandTable from "./expandTable.vue";
import { getAgentList } from "@/api/system";
export default {
  components: {
    Page,
    kyTable,
    ExpandTable,
  },
  data() {
    return {
      search_data: {
        ip: {
          name: "configure.suse_ip",
          type: "text",
        },
        normal_library_name: {
          name: "configure.normal_library_name",
          type: "select",
          items: [],
        },
        architecture: {
          name: "system.architecture",
          type: "select",
          items: [],
        },
        version: {
          name: "system.version",
          type: "select",
          items: [],
        },
        status: {
          name: "system.status",
          type: "select",
          items: [],
        },
      },
    };
  },
  methods: {
    getAgentList,
    handleComfirm(row) {
      let id = this.$route.params.id;
      this.$router.push({
        name: "suse_migrate_tool_migrate_confirm",
        params: {
          id,
          task_id: row.id,
        },
      });
    },
  },
};
</script>

<style>
</style>